package com.magnificent.atlantis.client.resources;

import com.magnificent.commons.utils.resource.AbstractResourceContainer;
import com.magnificent.commons.utils.resource.ResourceAllocator;
import com.magnificent.atlantis.client.MainLoad;

import javax.swing.*;
import java.io.IOException;
import java.util.Properties;

/**
 * User: Babanin
 * Date: 07.02.2009
 * Time: 1:19:05
 */
public class AtlantisClientResources extends AbstractResourceContainer {

    static {                                                                              
        ResourceAllocator.addResourceLocationClass(MainLoad.class);
        ResourceAllocator.addResourceLocationClass(AtlantisClientResources.class);
    }

    private static int buildValue = -1;

    // Background RGB: 229 229 229
    public static final ImageIcon LOGO = createImageIcon("logo.png");

    public static final ImageIcon ICON = createImageIcon("icon.png");
    public static final ImageIcon TASK = createImageIcon("basicTask.png");
    public static final ImageIcon MEETING = createImageIcon("newMeeting.png");

    public static final ImageIcon ADD = createImageIcon("add.png");
    public static final ImageIcon EDIT = createImageIcon("edit.png");
    public static final ImageIcon DELETE = createImageIcon("delete.png");

    public static final ImageIcon ADD_CONF = createImageIcon("addConf.png");
    public static final ImageIcon EDIT_CONF = createImageIcon("editConf.png");
    public static final ImageIcon DELETE_CONF = createImageIcon("deleteConf.png");
    public static final ImageIcon SYNCHRONIZE_CONF = createImageIcon("synchronizeConf.png");

    public static final ImageIcon ADD_EVENT = createImageIcon("addEvent.png");
    public static final ImageIcon EDIT_EVENT = createImageIcon("editEvent.png");
    public static final ImageIcon DELETE_EVENT = createImageIcon("deleteEvent.png");

    public static final ImageIcon UP = createImageIcon("up.png");
    public static final ImageIcon DOWN = createImageIcon("down.png");
    public static final ImageIcon BACK = createImageIcon("back.png");

    public static final ImageIcon SAVED = createImageIcon("saved.png");
    public static final ImageIcon NOT_SAVED = createImageIcon("notSaved.png");

    public static final ImageIcon BASIC_TASK = createImageIcon("basicTask.png");
    public static final ImageIcon MEETING_TASK = createImageIcon("meetingTask.png");

    public static final ImageIcon CONFIGURATION_TAB = createImageIcon("configurationTab.png");
    public static final ImageIcon TASKS_TAB = createImageIcon("tasksTab.png");
    public static final ImageIcon EVENTS_TAB = createImageIcon("eventTab.png");
    public static final ImageIcon MESSAGES_TAB = createImageIcon("mailTab.png");

    public static final ImageIcon LOCAL_CONF = createImageIcon("local.png");
    public static final ImageIcon SERVER_CONF = createImageIcon("server.png");

    public static final ImageIcon ADD_COMMENT = createImageIcon("addComment.png");

    public static final ImageIcon NEW_MESSAGE = createImageIcon("newMessage.png");
    public static final ImageIcon FORWARD_MESSAGE = createImageIcon("forwardMessage.png");
    public static final ImageIcon DELETE_MESSAGE = createImageIcon("deleteMessage.png");
    public static final ImageIcon MESSAGE_TRANSFER = createImageIcon("messageTransfer.png");

    public static final ImageIcon REFRESH_USERS = createImageIcon("refreshUsers.png");

    public static final ImageIcon ROBOT = createImageIcon("robot.png");
    public static final ImageIcon WORKER = createImageIcon("worker.png");
    public static final ImageIcon MANAGER = createImageIcon("manager.png");

    public static final ImageIcon RUN = createImageIcon("run.gif");
    public static final ImageIcon STOP = createImageIcon("stop.gif");

    public static final ImageIcon PLUS = createImageIcon("plus.png");
    public static final ImageIcon MINUS = createImageIcon("minus.png");

    public static int getBuildNumber() {
        if (buildValue == -1) {
            Properties properties = new Properties();

            try {
                properties.load(ResourceAllocator.getResource("build.number"));
            } catch (IOException e) {
                throw new RuntimeException(e);
            }

            buildValue = Integer.parseInt(properties.getProperty("build.number"));
        }

        return buildValue;
    }
}
